package cn.tworice.backup.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

@Configuration
public class BackupTaskSchedulerConfig {
    @Bean(name = "backupTaskScheduler")
    public ThreadPoolTaskScheduler customTaskScheduler() {
        ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
        scheduler.setPoolSize(1); // 设置线程池大小
        scheduler.setThreadNamePrefix("BackupTaskScheduler-"); // 设置线程名前缀
        return scheduler;
    }
}
